﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;

namespace SimpleTaskManager.Domain.Entities
{
    /// <summary>
    /// The association class between Users and Skills
    /// </summary>
    public class User_Skill
    {
        /// <summary>
        /// ID field
        /// </summary>
        public int User_SkillID { get; set; }

        /// <summary>
        /// The ID of the user who has the skill
        /// </summary>
        [Display(Name="User")]
        public int UserId { get; set; }

        /// <summary>
        /// The user who has the skill
        /// </summary>
        [ForeignKey("UserId")]
        public virtual User User { get; set; }

        /// <summary>
        /// The ID of the skill
        /// </summary>
        [Display(Name = "Skill")]
        public int SkillId { get; set; }

        /// <summary>
        /// The skill
        /// </summary>
        [ForeignKey("SkillId")]
        public virtual Skill Skill { get; set; }

        /// <summary>
        /// A number between 0 and 5, representing the skill level of the user
        /// </summary>
        [Range(0, 5)]
        public int Rating { get; set; }

        /// <summary>
        /// The ID of the user who approved the skill
        /// </summary>
        [Display(Name="Approved by")]
        public int? ApprovedById { get; set; }

        /// <summary>
        /// A field showing which user approved this skill
        /// </summary>
        [ForeignKey("ApprovedById")]
        public virtual User ApprovedBy { get; set; }
    }
}
